<?php
	namespace app\models\demo_code;
	use yii\base\Model;
	class code extends Model{
		//初始化一个变量，其实就是验证码
		public $verify_code;
		public function rules(){
			return [
				//对上面变量的字段进行验证
				['verify_code','captcha','captchaAction'=>'demo_code/demo/captcha'],
				['verify_code','required','message'=>'不能为空']
			];
		}
	}
?>